package com.hotel.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.hotel.dto.ReservationPageQueryDTO;
import com.hotel.entity.Reservation;
import com.hotel.vo.ReservationDetailVO;
import com.hotel.vo.ReservationVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ReservationMapper extends BaseMapper<Reservation> {
    /**
     * 预约分页查询
     * @param reservationPageQueryDTO
     * @return
     */
    Page<ReservationVO> pageQuery(ReservationPageQueryDTO reservationPageQueryDTO);

    /**
     * 根据id查询预约信息
     * @param id
     * @return
     */
    ReservationDetailVO getDetailById(Integer id);

    /**
     * 取消预约
     * @param id
     */
    @Update("update reservation set status = 4 where id = #{id}")
    void cancel(Integer id);
}
